﻿using B.S.DataBase.MyProject.Domain.DiagnosisAndTreatmentManagement;
using B.S.DataBase.MyProject.Domain.HealthMonitoring;
using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using MedicalPCTerminal.Read.API.Appcation.Commands.HealthMonitoringCommand;
using MedicalPCTerminal.Read.API.Appcation.Commands.Management;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace MedicalPCTerminal.Read.API.Controllers
{
    /// <summary>
    /// 健康监测-读
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class HealthMonitoringController : ControllerBase
    {
        /// <summary>
        /// 中介者
        /// </summary>
        private readonly IMediator mediator;


        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="mediator"></param>
        public HealthMonitoringController(IMediator mediator)
        {

            this.mediator = mediator;
        }
        /// <summary>
        /// 查询BMI
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<APIResult<List<BMIMonitoring>>> GetBMI([FromQuery]GetBMICommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 查询血压
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<APIResult<List<BloodPressure>>> GetBloodPressure([FromQuery] GetBloodPressureCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 查询血糖
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<APIResult<List<BloodSugar>>> GetBloodSugar([FromQuery] GetBloodSugarCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
